package com.hxkj.utils;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
/***
 * chenfanfzhou
 * 获取图片像素
 * **/
public class ImgUtils {
    public static boolean checkImageSize(String path,int width,int height) throws Exception{
        File file = new File(path);
        BufferedImage bi = null;
        try {
            bi = ImageIO.read(file);
            int width_ = bi.getWidth();
            int height_ = bi.getHeight();
            System.out.println("width:" + width + "----height:" + height);
            if (width == width_ && height == height_) {
                return true;
            } else {
                return false;
            }
        } catch (IOException e) {
            e.printStackTrace();
            throw e;
        }
    }
}

